﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace GameJamSnake
{
    public class TextureManager
    {
        private static TextureManager instance;
        private TextureManager() 
        {
            m_textures = new Dictionary<String, Texture2D>();
        }

        private Dictionary<String, Texture2D> m_textures;

        public void Load(String location, String tag, ContentManager contentManager)
        {
            Texture2D temp = contentManager.Load<Texture2D>(location);
            m_textures.Add(tag, temp);
        }

        public Texture2D GetTex(String tag)
        {
            Texture2D temp = null;

            if (m_textures.TryGetValue(tag, out temp))
            {
                return temp;
            }
            else
            {
                return null;
            }
        }

        public static TextureManager Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new TextureManager();
                }

                return instance;
            }
        }
    }
}